﻿using JBeamLibrary.VehicleParts.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBeamLibrary.VehicleParts.Elements;
using JBeamLibrary.VehicleParts.Interfaces;

namespace JBeamLibrary.VehicleParts.Groups
{
    public class NodeSection : VehicleSection<Node>
    {
        #region Fields

        private readonly NodeCollection _collection = new NodeCollection();

        #endregion

        #region Indexers

        public Node this[string nodeId]
        {
            get { return _collection[nodeId]; }
        }

        #endregion

        #region CTORs

        public NodeSection(VehiclePart part)
            : base(part)
        {

        }

        #endregion

        #region VehicleSection

        public override string Name
        {
            get { return "nodes"; }
        }

        public override Interfaces.IVehicleGroupCollection<Node> ElementCollection
        {
            get { return _collection; }
        }

        public IEnumerable<INumeric> NumericNodes
        {
            get { return ((NodeCollection)ElementCollection).Where(node => node.NumericId > 0); }
        }

        public NodeCollection Nodes
        {
            get { return ((NodeCollection)ElementCollection); }
        }

        #endregion
    }
}
